<template>
	<view class="multi-container">
		<!-- <view class="multi-head" v-if="banner !== undefined">
			<view class="multi-head-left"> <text class="multi-topic">{{banner.title}}</text>
			</view>
			<view class="multi-head-right" @click="press"> <text class="multi-link">{{banner.link}}</text>
				<image class="multi-arrow" src="/static/arrow.png"></image>
			</view>
		</view> -->
		<view v-if="datas==0" class="text-center text-grey padding">无数据</view>
		<view v-else>
			<view class="multi-list" v-if="num === 1">
				<!-- 这里需要用户自行定义商品点击事件 -->
				<view v-for='(item,index) in datas' :key='index' class="multi-product1" @click="detail(item)">
					<image style="width: 100%;" mode="aspectFill" class="multi-image1" :src="item.uri"></image>
					<view class="multi-description"> <text class="multi-title">{{item.title}}</text> <text class="multi-subtitle">{{item.subtitle}}</text>
						<view> <text class="multi-specialprice">{{item.specialprice}}</text> <text class="multi-originprice">{{item.originprice}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="multi-list" v-if="num === 2">
				<!-- 这里需要用户自行定义商品点击事件 -->
				<view v-for='(item,index) in datas' :key='index' class="multi-product2" @click="detail(item)">
					<image style="width: 100%;" mode="aspectFill" class="multi-image2" :src="item.uri"></image>
					<view class="multi-description"> <text class="multi-title">{{item.title}}</text> <text class="multi-subtitle">{{item.subtitle}}</text>
						<view><text class="multi-specialprice">{{item.specialprice}}</text> <text class="multi-originprice">{{item.originprice}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="multi-list" v-if="num === 3">
				<!-- 这里需要用户自行定义商品点击事件 -->
				<view v-for='(item,index) in datas' :key='index' class="multi-product3" @click="detail(item)">
					<image style="width: 100%;" mode="aspectFill" class="multi-image3" :src="item.uri"></image>
					<view class="multi-description"> <text class="multi-title">{{item.title}}</text> <text class="multi-subtitle">{{item.subtitle}}</text>
						<view> <text class="multi-specialprice">{{item.specialprice}}</text> <text class="multi-originprice">{{item.originprice}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="multi-list" v-if="num === 4">
				<!-- 这里需要用户自行定义商品点击事件 -->
				<view v-for='(item,index) in datas' :key='index' class="multi-product4" @click="detail(item)">
					<image style="width: 100%;" mode="aspectFill" class="multi-image4" :src="item.uri"></image>
					<view class="multi-description"> <text class="multi-title">{{item.title}}</text> <text class="multi-subtitle">{{item.subtitle}}</text>
						<view> <text class="multi-specialprice">{{item.specialprice}}</text> <text class="multi-originprice">{{item.originprice}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'list-mall',
		props: {
			banner: {},
			num: Number,
			datas: {
				type: Array,
				default: function() {
					return []
				}
			}
		},
		methods: {
			detail(item) {
				console.log(item)
				this.$jump('/pages/product/detail?id=' + item.id)
			}
		}
	}
</script>

<style lang="scss">
	.multi-container {
		display: flex;
		flex-direction: column;
		width: 750upx;

		.multi-head {
			display: flex;
			justify-content: space-between;
			align-content: center;
			align-items: center;
			margin: 24upx 30upx 23upx 30upx;

			.multi-head-left {
				display: flex;
				align-content: flex-end;

				.multi-topic {
					color: #1A1A1A;
					font-size: 31upx;
					line-height: 40upx;
					margin-right: 30upx;
					align-self: center;
				}

				.multi-time {
					align-self: center;
				}
			}



			.multi-head-right {
				display: flex;
				align-content: center;
				align-items: flex-end;

				.multi-link {
					color: #1A1A1A;
					opacity: 0.5;
					font-size: 27upx;
					margin-right: 14upx;
					align-self: center;
				}

				.multi-arrow {
					width: 16upx;
					height: 28upx;
					align-self: center;
				}
			}

		}
	}


	.multi-list {
		display: flex;
		border-color: #0000ff;
		flex-wrap: wrap;
		justify-content: space-between;
		margin-left: 25upx;
		margin-right: 25upx;

		.multi-product1 {
			display: flex;
			flex-direction: column;
			width: 100%;
			margin-bottom: 30upx;

			.multi-image1 {
				border-top-left-radius: 8upx;
				border-top-right-radius: 8upx;
				width: 690upx;
				height: 350upx;
				margin-bottom: 8upx;
			}
		}

		.multi-product2 {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			width: 49%;
			margin-bottom: 30upx;
			background-color: #FFFFFF;

			.multi-image2 {
				border-top-left-radius: 8upx;
				border-top-right-radius: 8upx;
				width: 333.3upx;
				height: 333.3upx;
				margin-bottom: 8upx;
			}
		}


		.multi-product3 {
			display: flex;
			flex-direction: column;
			width: 33.3%;
			margin-bottom: 30upx;
			background-color: #FFFFFF;

			.multi-image3 {
				border-top-left-radius: 8upx;
				border-top-right-radius: 8upx;
				width: 217upx;
				height: 217upx;
				margin-bottom: 8upx;
			}
		}


		.multi-product4 {
			display: flex;
			flex-direction: column;
			width: 25%;
			margin-bottom: 30upx;
			background-color: #FFFFFF;

			.multi-image4 {
				border-top-left-radius: 8upx;
				border-top-right-radius: 8upx;
				width: 158upx;
				height: 160upx;
				margin-bottom: 8upx;
			}
		}

		.multi-description {
			display: flex;
			flex-direction: column;
			padding: 3px;

			.multi-title {
				color: #1A1A1A;
				font-size: 28upx;
				margin: 8upx 0;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}

			.multi-subtitle {
				color: #1A1A1A;
				opacity: 0.5;
				font-size: 22upx;
				line-height: 27upx;
				margin-left: 8upx;
			}

			.multi-specialprice {
				color: #C5A16F;
				line-height: 27upx;
				margin-left: 8upx;
				margin-top: 3px;
			}

			.multi-originprice {
				color: grey;
				opacity: 0.5;
				text-decoration: line-through;
				font-size: 24upx;
				line-height: 27upx;
				margin-left: 8upx;
			}
		}



	}
</style>
